import matplotlib.pyplot as plt
from next_level.Finance_Data.make_plot import makeplot
from next_level.Finance_Data.stock_load import load_stock

# 此模块优化的为 main.py 模块的内容
def do_duo_plot(stock1_df,stock2_df,name1,name2):
    '''绘制两支股票的图形
    参数是数据框和对应的股票代码
    '''
    makeplot(stock1_df,'Close',name1+' closing prices')
    makeplot(stock2_df, 'Close', name2+' closing prices')

    plt.title(name1 + ' vs. ' + name2 + ' Stock Prices')
    plt.show()


if __name__ == '__main__':
    stock1_df = load_stock('MSFT')
    stock2_df = load_stock('AAPL')
    do_duo_plot(stock1_df,stock2_df,'MSFT','AAPL')

